package com.evenus.infrastructure.parser;

import java.io.InputStream;

import org.apache.tika.Tika;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class TikaParser implements Parser {

	private Logger logger = LoggerFactory.getLogger(TikaParser.class);
	
	public String parseToString(InputStream stream) {
		String context = "";
		
		Tika tika = new Tika();
		
		try {
			context = tika.parseToString(stream);
		} catch (Exception e) {
			logger.error("Parse Error:" + e.toString());
		}
		
		return context;
	}

	
}
